import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Scanner;

/**
 * @License: (C) Copyright 2013-2022
 * @Contact: abcque@outlook.com
 * @IDE: IntelliJ IDEA
 * @Encoding: utf-8
 * @Project: st2214st2215
 * @Package: PACKAGE_NAME
 * @File: StreamTest.java
 * @Time: 2023/4/25 14:15
 * @Author: abcque
 * @Description:
 * @Modifier:
 * @ModifyDate:
 * @ModifyRemark:
 */
public class StreamTest {
    public static void main(String[] args) {
        // Scanner scanner = new Scanner(System.in);
        // int i = scanner.nextInt();
        // System.out.println("i = " + i);

        /*// System.in和System.out方法
        // 缺点一: 该方法能获取从键盘输入的字符，但只能针对一个字符的获取
        // 缺点二: 获取的只是char类型的。如果想获得int,float等类型的输入,比较麻烦
        System.out.println("请输入一个字符：");
        InputStream in = System.in;

        try {
            char read = (char) in.read();
            System.out.println("您输入的字符是：" + read);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
        }*/

        System.out.println("请输入一个字符：");
        InputStreamReader reader = new InputStreamReader(System.in);
        try {
            char read = (char) reader.read();
            System.out.println("您输入的字符是：" + read);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
